package com.kmxd.ams.app.event.efile.command;

import com.kmxd.ams.app.convert.DocConvertUtil;
import com.kmxd.ams.client.event.efile.EfileConvertEvent;
import com.kmxd.ams.client.oss.IEfileRecordSvc;
import com.kmxd.ams.client.system.ISysConfigSvc;
import com.kmxd.ams.client.system.ISysFondsSvc;
import com.kmxd.ams.core.common.constant.*;
import com.kmxd.ams.core.config.AmsConfig;
import com.kmxd.ams.core.oss.template.OssTemplate;
import com.kmxd.ams.infra.system.entity.SysFonds;
import com.kmxd.ams.infra.system.mapper.SysFondsMapper;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;

/**
 * 电子文件转换
 *
 * @author ZuoLG
 */
@Slf4j
@Component
@AllArgsConstructor
public class EfileConvertCmd {
  private final SysFondsMapper sysFondsMapper;
  private IEfileRecordSvc efileSvc;
  private OssTemplate ossTemplate;
  private ISysConfigSvc sysConfigSvc;
  private ISysFondsSvc sysFondsSvc;
  private DocConvertUtil convertUtil;
  private AmsConfig amsConfig;
  private final RedissonClient redissonClient;

  /** 电子文件转换 */
  public void efileConvert(EfileConvertEvent event) throws Exception {
    log.debug("docIds: {} ", event.getReq().toString());
    // 查询所有全宗，
    List<SysFonds> fondsList = sysFondsSvc.list();
    fondsList.forEach(
        fonds -> {
          try {
          } catch (Exception e) {
            log.error("文件格式转换失败", e);
            log.info("全宗:【{}】编码:【{}】不具备电子文件转换条件，请检查电子文件表！", fonds.getName(), fonds.getCode());
          }
        });
  }
}
